﻿function Get-TSMStatus {    
    <#
        .SYNOPSIS
            Get TSM server status
                    
        .DESCRIPTION
            The Get-TSMStatus returns the status of the TSM server
            
        .EXAMPLE
            Get-TSMStatus

        .NOTES
            Contributors:  David Seibel
            Last Revision Date: 09/01/2015

    #>
    [CmdletBinding()]
    Param()

    $query = Format-TSMQuery -Table "STATUS"
    $result = Invoke-TSMCommand -Command $query

    $defaultDisplaySet = 'SERVER_NAME','SERVER_HLA','SERVER_LLA'
    $typeDefinitions = @{
                        "ACTLOGRETENTION"    = [Int32]
                        "CLIENTACTDURATION"  = [Int32]
                        "CPUINFO_REFRESH"    = [Int32]
                        "EVENTRETENTION"     = [Int32]
                        "INSTALL_DATE"       = [DateTime]
                        "INVALIDPWLIMIT"     = [Int32]
                        "LASTLICENSEAUDIT"   = [DateTime]
                        "LAST_REFRESH"       = [DateTime]
                        "LDAP_PASSSET"       = [bool]  
                        "LEVEL"              = [Int32]
                        "LICENSEAUDITPERIOD" = [Int32]
                        "MAXCMDRETRIES"      = [Int32]
                        "MAXSCHEDSESSIONS"   = [Int32]
                        "MAXSESSIONS"        = [Int32]
                        "MINPWLENGTH"        = [Int32]
                        "PASSEXP"            = [Int32]
                        "QUERYSCHEDPERIOD"   = [Int32]
                        "RANDOMIZE"          = [Int32]
                        "REFRESH_INTERVAL"   = [Int32]
                        "RELEASE"            = [Int32]
                        "RESTART_DATE"       = [DateTime]
                        "RETRYPERIOD"        = [Int32]
                        "SERVER_PASSSET"     = [bool]
                        "SPACEAVAIL_MB"      = [Double]
                        "SPACEUSEDONFS_MB"   = [Double]
                        "SUBFILE"            = [bool]
                        "SUBLEVEL"           = [Int32]
                        "SUMMARYRETENTION"   = [Int32]
                        "SUROCC_DATE"        = [DateTime]
                        "TOCLOADRETENTION"   = [Int32]
                        "TOTALFS_MB"         = [Double]
                        "TOTALSUROCC_TB"     = [Double]
                        "VERSION"            = [Int32]
                        }

    return Format-TSMData -Data $result -TypeDefinitions $typeDefinitions -DefaultDisplaySet $defaultDisplaySet
}